

=[ public: utermlist>deep-for $VAR ∈ $LIST, begin ]
{
	utermlist_t *list$UNIQ= $LIST;
	 if (!utermlist_isempty(list$UNIQ)) {
		/* FIXME: do this with a proper stack */
		struct { struct utermlist_t_NODE *head, *current; }
			stack$UNIQ[100000],
			T$UNIQ;
		int tos$UNIQ;
		tos$UNIQ= 0;
		stack$UNIQ[0].head= &list$UNIQ->head;
		stack$UNIQ[0].current= list$UNIQ->head.next;

		do {
			uterm_t *var$UNIQ;
			T$UNIQ= stack$UNIQ[tos$UNIQ--];
			var$UNIQ= T$UNIQ.current->data;
			if(1) {
				uterm_t *$VAR=var$UNIQ;
				struct utermlist_t_NODE* $VAR_node=
					T$UNIQ.current;

=[ public: utermlist>deep-for $VAR ∈ $LIST, end ]
			}
			if (T$UNIQ.current->next!=T$UNIQ.head) {
				T$UNIQ.current= T$UNIQ.current->next;
				stack$UNIQ[++tos$UNIQ]= T$UNIQ;
			}
			switch (var$UNIQ->kind) {
			case ut_cu_bulk:
			case ut_sq_bulk:
			case ut_ro_bulk:
				T$UNIQ.head= &var$UNIQ->body->head;
				T$UNIQ.current= T$UNIQ.head->next;
				if (T$UNIQ.head!=T$UNIQ.current)
					stack$UNIQ[++tos$UNIQ]= T$UNIQ;
				break;
			default:
				break;
			}
		} while(tos$UNIQ!=-1);
	}
}